import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'
import Home from '../views/Home'
import Test1 from '../views/Test1'
import Test2 from '../views/Test2'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Login',
    component: Login,
    // 循环整个路由 登录也会被循环到，所以加个标签
    hidden:true
  },
  {
    path: '/home',
    // name: 'Home', 如何很多菜单的话，需要在路由的配置里添加，频繁添加菜单重复 所以如下
    name: '导航一', //【将菜单和路由数据统一起来】，将路由数据动态渲染到菜单上 
    component: Home,
    // 控制router-view在指定位置跳转 页面跳转bug解决
    children: [
      {
        path: '/test1',
        // name: 'Test1',
        name: '选项1',
        component: Test1
      },
      {
        path: '/test2',
        // name: 'Test2',
        name: '选项2',
        component: Test2
      }
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
